<?php


class UserManager {

    public function __construct(Mypdo $db){
        $this->db= $db;
    }

    public function logUser($login_user, $pwd_user){
        $req = $this->db->prepare('SELECT * FROM user
									WHERE login_user = :login_user');
        $req->bindValue(':login_user', $login_user, PDO::PARAM_INT);

        $req->execute();
        $user = new User($req->fetch(PDO::FETCH_OBJ));
        $req->closeCursor();

        if($login_user == $user->getLoginUser() && md5($pwd_user.'48@!alsd') == $user->getPwdUser()){

            $_SESSION['login'] = $user->getLoginUser();
            $_SESSION['email'] = $user->getEmailUser();
        }
        else{
            header('Location: index.php?page=9');
        }


    }
} 